package demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-03-25
 * Time: 23:26
 */
public class Main {
    public static void running(Runnable runnable) {
        runnable.run();
    }
    public static void playing(Playable playable) {
        playable.run();
    }
    public static void main(String[] args) {
        Athlete athlete = new Athlete();

        // 直接调用对象的 run()
        athlete.run();  // 输出：运动员在跑步或听音乐

        // 多态调用：通过不同接口引用调用 run()
        running(athlete);//运动员在跑步或听音乐

        playing(athlete);//运动员在跑步或听音乐
    }
}
